<template>
  <div class="app-container">
    <div class="zd3">
      <div class="zd3-title">
        <p>
          <span>维修单号</span>
          <input v-model="searchData.invoiceNumber" type="text" placeholder="请输入维修单号" />
        </p>
        <p>
          <span>处理人</span>
          <input v-model="searchData.suppliesName" type="text" placeholder="请输入处理人" />
        </p>
        <el-button size="small" type="success" @click="getList">查询</el-button>
        <el-button size="small" @click="resetList">重置</el-button>
        <el-button size="small" type="primary" @click="addPermission">新增</el-button>
      </div>
      <div class="zd3-btm">
        <el-table
          :data="tableData"
          style="width: 100%;border-radius: 8px;"
          :show-header="showHeader"
          v-loading="loading"
        >
          <el-table-column type="index" align="center" label="序号" width="80" />
          <el-table-column align="center" prop="status" label="办理状态">
            <template slot-scope="scope">
              <div class="orderStatus">
								<p v-if='scope.row.status == 0' class="yellow">未确认</p>
								<p v-if='scope.row.status == 1' class="blue">进行中</p>
								<p v-if='scope.row.status == 2' class="green">落实</p>
              </div>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="orderNumber" label="变更单号" />
          <el-table-column align="center" prop="time" label="业务日期" />
          <el-table-column align="center" prop="time" width="150" label="所属公司变更为" />
          <el-table-column align="center" prop="money" label="金额变更为" />
          <el-table-column align="center" prop="people" label="处理人" />
          <el-table-column align="center" prop="remark" label="变更说明" />
          <el-table-column align="center" prop="detail" label="资产明细">
            <template slot-scope="scope">
              <p class="godetail" @click="goDetail(scope.row)">{{scope.row.detail}}</p>
            </template>
          </el-table-column>
          <el-table-column align="center" width="200" label="操作" fixed="right">
            <template slot-scope="scope">
							<el-button type="text" size="small" @click="write(scope.row,scope.$index)">编辑</el-button>
              <el-popconfirm
                placement="top"
                hideIcon
                title="是否要删除此行？"
                @onConfirm="deleteRow(scope.row)"
              >
                <el-button type="text" size="small" slot="reference">删除</el-button>
              </el-popconfirm>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          background
					align="right"
					:page-size="50"
          layout="prev, pager, next"
          :total="total"
					@current-change='goPage'
          @prev-click="goPrev"
          @next-click="goNext"
        />
      </div>
    </div>
  </div>
</template>

<script>
import { getTestFahuo,deleteTestFahuo } from "@/api/testcenter"
export default {
  data() {
    return {
      content: "",
      total: 1,
      page: 1,
      dialogVisible: false,  //弹窗
      drawer: false,   //抽屉
      showHeader: true,
      loading: true,
      tableData: [{
        orderNumber: '551564122',
        remark: '清理说明',
        people: '清理人',
        time: '清理日期',
        status: '状态',
        detail: '资产明细',
        money: 100
      }],   //数据列表
      tempData: {},    //修改增加承载数据
      searchData: {},  //搜索承载数据
      time: '',       //购入日期
      proData:[],     //资产数据
      tempIndex: -1,
      ifydata: [],
      checkList: []
    };
  },
  mounted() {
    this.loading = false
    // this.getList()
  },
  methods: {
    goDetail(data){
      console.log(data)
      this.$router.push({
        name: 'Zichanmingxi'
      })
    },
    finish(data){
      this.dialogVisible = true
      this.tempData = data
    },
    getList() {
      getTestFahuo(this.searchData).then(res => {
        console.log(res);
        this.tableData = res.data;
        this.total = res.data.total
        this.loading = false;
      })
    },
    designUpFile(item){
      formData.append("file", item.file)
      importDaoshiCaigou(formData).then(res => {
        console.log(res)
        this.$message({
          message: res.data.message,
          type: 'success'
        })
      })
    },
    write(item, index) {
      console.log(item);
      this.$router.push({
        name: 'Writecaiwu',
        params: {
          options: JSON.stringify(item)
        }
      })
    },
    look(item){
      this.$router.push({
        name: 'Writecaiwu',
        params: {
          options: JSON.stringify(item),
          look: true
        }
      })
    },
    deleteRow(item) {
      console.log("删除");
      deleteTestFahuo(item.cid).then(res => {
        console.log(res);
        this.$message({
          showClose: true,
          message: res.message,
          type: "success"
        });
        this.getList();
      });
    },
    goPrev(page) {
      console.log(page)
      this.page--
      this.getList()
    },
    goNext(page) {
      console.log(page)
      this.page++
      this.getList()
    },
    goPage(page){
      console.log(page)
      this.page = page
      this.getList()
    },
    resetList() {
      this.searchData = {};
    },
    addPermission() {
      this.$router.push({
        name: 'Writecaiwu'
      })
    }
  }
};
</script>

<style lang="scss" scoped>
.orderStatus {
  display: flex;
	justify-content: center;
  > p {
    padding: 0px 5px;
    color: #fff;
    font-size: 12px;
    border-radius: 2px;
    margin: 0 0px 0 0;
  }
  .blue {
    background: #3a87ad;
  }
  .green {
    background: #18a05e;
  }
  .yellow {
    background: #ff7a0e;
  }
  .red {
    background: #c60000;
  }
  .zise{
    background: #c7ab10
  }
}
.godetail{
  font-size: 14px;
  color: #18A05E;
  cursor: pointer;
}
/deep/.el-divider {
	background-color: #18A05E;
	position: relative;
}
.fanwei{
  padding-right: 20px;
}
/deep/.el-divider--horizontal {
  margin: 30px 0;
}
/deep/.el-divider__text {
	color: #18A05E;
  font-size: 16px;
}
/deep/.el-button--primary {
  color: #fff;
  background-color: #18a05e !important;
  border-color: #18a05e !important;
}
/deep/.el-button--primary:hover,
.el-button--primary:focus {
  background: #18a05e !important;
  border-color: #18a05e !important;
  color: #fff !important;
}
/deep/.el-button:hover,
.el-button:focus {
  color: #18a05e;
  background-color: transparent;
}
/deep/.el-button--primary {
  color: #fff;
  background-color: #18a05e;
  border-color: #18a05e;
}
/deep/.el-button--text {
  color: #00c666 !important;
}
.upload-demo{
  margin-left: 10px;
}
.app-container {
  padding: 10px;
}
.ellisp{
	width: 100%;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	overflow: hidden;
	text-align: left;
}
.rolestip {
  width: 100%;
  display: flex;
  justify-content: center;
}
.inps {
  width: 100%;
  height: 32px;
  line-height: 32px;
  padding-left: 10px;
  background: none;
  border: none;
  color: #333;
}
.inps-active {
  width: 100%;
  height: 32px;
  line-height: 32px;
  padding-left: 10px;
  // background:#ccc;
  border: none;
  color: #333;
}
.s-img{
  width: 80px;
  height: 80px;
}
.zd3-title {
	height: 70px;
	display: flex;
	align-items: center;
	padding: 0 20px;
	position: relative;
	background: #ffffff;
	border-radius: 8px;
	border: 1px solid rgba(0, 0, 0, 0.1);

	> p {
		font-size: 14px;
		color: #333;
		margin-right: 20px;

		> span {
			padding-right: 20px;
		}

		> input {
			width: 150px;
			height: 32px;
			// background: #ccc;
			border-radius: 3px;
			border: 1px solid #ccc;
			padding-left: 10px;
			color: #333;
		}
	}

	> h3 {
		// width: 64px;
		height: 32px;
		background: #18a05e;
		border-radius: 3px;
		margin: 0 30px 0 0;
		padding: 0 15px;
		color: #fff;
		font-size: 14px;
		line-height: 32px;
		font-weight: 100;
		text-align: center;
		cursor: pointer;
	}

	> h4 {
		padding: 0 15px;
		height: 32px;
		border-radius: 3px;
		border: 1px solid rgba(0, 0, 0, 0.1);
		color: #333;
		font-size: 14px;
		line-height: 32px;
		font-weight: 100;
		text-align: center;
		cursor: pointer;
	}
}
/deep/.el-pagination.is-background .el-pager li:not(.disabled).active {
  background-color: #18a05e;
  color: #fff;
}
.zd3-btm /deep/.btn-prev:after {
  content: "上一页";
}
.zd3-btm /deep/.btn-next:before {
  content: "下一页";
}
.zd3-btm /deep/.btn-prev,
.zd3-btm /deep/.btn-next {
  width: 65px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.zd3-btm {
  background: rgba(255, 255, 255, 1);
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  margin-top: 10px;
  overflow: hidden;
  &-title {
    display: flex;
    align-items: center;
    height: 70px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: #ffffff;
    > p {
      text-align: center;
      font-size: 16px;
      color: #333;
    }
  }
  .el-pagination {
		white-space: nowrap;
		padding: 15px 5px;
		color: #303133;
		font-weight: bold;
	}
  .addDate {
    margin: 20px 32px 10px 32px;
    height: 32px;
    border-radius: 3px;
    text-align: center;
    line-height: 32px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    border: 1px dashed rgba(0, 0, 0, 0.25);
  }
  .el-button--text {
    margin: 0 10px;
  }
}
// .dialog{
//   height: 350px;
//   overflow-y: auto;
// }
/deep/.el-dialog__body{
  padding: 10px 20px;
}
.change1{
  display: flex;
  padding: 20px 20px 20px 0;
  flex-wrap: wrap;
  > p {
    width: 100%;
    font-size: 14px;
    display: flex;
    margin: 10px 0;
    align-items: center;
    color: #999;
    > span {
      display: block;
      width: 120px;
      text-align: right;
      padding-right: 15px;
      color: #18A05E;
    }
  }
}
.change {
  display: flex;
  padding-right: 20px;
  flex-wrap: wrap;
  .fuxuan{
    display: flex;
    justify-content: center;
    margin: 10px auto;
  }
  > p {
    width: 100%;
    font-size: 14px;
    display: flex;
    margin: 10px 0;
    align-items: center;
    color: #333;
    /deep/.el-input__inner {
      width: inherit;
      background: none;
      height: 32px;
      // line-height: 32px;
      color: #333;
      border: 1px solid rgba(0, 0, 0, 0.1);
      padding: 0 25px;
    }
    /deep/.el-input__icon {
      line-height: 32px;
    }
    .userselect {
      // max-width: 250px;
      flex: 1;
    }

    > span {
      display: block;
      width: 120px;
      text-align: right;
      padding-right: 15px;
    }
    > input {
      width: inherit;
      flex: 1;
      height: 32px;
      border-radius: 3px;
      border: 1px solid rgba(0, 0, 0, 0.1);
      padding-left: 10px;
      color: #333;
    }
  }
}
</style>
